[image, bufferedimage] = fig2image(fig,insets)
Convert Matlab figure to java image.
fig | figure | optional, handle of figure to convert to a java image default value: gcf |
insets | number[4] | insets=[left bottom right top] optional arguments, defaults to [0 0 0 0] |
image | java.awt.Image | |
bufferedimage | java.awt.image.BufferedImage | An image with an accessible buffer with image data |
hfig=figure; plot(1:10); [img, bimg] = fig2image(hfig); html = image2html(bimg, 'png'); delete(hfig) disp(html)
print the figure to a temporary .png file using Matlab's print method get bufferedimage with javax.imageio.ImageIO and make an image from the bufferedimage with java.awt.Toolkit. Copyright 2006-2019 Modelit, www.modelit.nl